import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/api/bookstore2/trafficDispatchTasks',
    method: 'get',
    params
  })
}

export function getById(id) {
  return request({
    url: '/api/bookstore2/trafficDispatchTasks/' + id,
    method: 'get'
  })
}

export function noticeLineUp(dto) {
  return request({
    url: '/api/bookstore2/trafficDispatchTasks/noticeLineUp',
    method: 'post',
    data: dto
  })
}

export function confirmLineUp(dto) {
  return request({
    url: '/api/bookstore2/trafficDispatchTasks/confirmLineUp',
    method: 'post',
    data: dto
  })
}


export function executeTask(id, status) {
  return request({
    url: `/api/bookstore2/trafficDispatchTasks/${id}/execute/${status}`,
    method: 'post',
  })
}

export function switchDriver(id, itemId, driver) {
  return request({
    url: `/api/bookstore2/trafficDispatchTasks/${id}/items/${itemId}/switchDriver/${driver}`,
    method: 'put'
  })
}
